<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title> </title>


</head>

<body>
    sdfdsf
    <script>
        let arr = [{
            Category: 'A',
            Amount: 1,
        }, {
            Category: 'B',
            Amount: 2,
        }, {
            Category: 'A',
            Amount: 3,
        }, {
            Category: 'C',
            Amount: 4,
        }, {
            Category: 'B',
            Amount: 5,
        }, {
            Category: 'C',
            Amount: 6,
        }, {
            Category: 'A',
            Amount: 7,
        }, {
            Category: 'C',
            Amount: 8,
        }];
        let temp = {};
        let end = [];
        for (let i = 0; i < arr.length; i++) {
            let a = arr[i];
            if (!temp[a.Category]) {
                let jjbs = i +1
                end.push({
                    Category: a.Category,
                    data: [a]
                });
                temp[a.Category] = a;
            } else {
                for (let j = 0; j < end.length; j++) {
                    let b = end[j];
                    if (b.Category == a.Category) {
                        b.data.push(a);
                        break;
                    }
                }

            }
        };
        console.log(end);
    </script>
</body>

</html>
